/*
 * Copyright (C) 2009 Jakub Miara
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.araim;

import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;

public class BackgroundColorAnimation extends BackgroundAnimation {

	private int sColor = 0;
	private int eColor = 0;

	public BackgroundColorAnimation(View v, int startcolor, int endcolor, int interval,View[] touchListenersToSet) {
		super(new ColorDrawable[] { new ColorDrawable(startcolor), new ColorDrawable(endcolor) }, v, interval,touchListenersToSet);
	}

	public void start(int color) {
		setDrawableByLayerId(0, sDrawable);
		setDrawableByLayerId(1, new ColorDrawable(color));
		startTransition(animationInterval);
	}

	public int getAnimationInterval() {
		return animationInterval;
	}

	public void setAnimationInterval(int animationInterval) {
		this.animationInterval = animationInterval;
	}

	public int getsColor() {
		return sColor;
	}

	public void setsColor(int sColor) {
		this.sColor = sColor;
	}

	public int geteColor() {
		return eColor;
	}

	public void seteColor(int eColor) {
		this.eColor = eColor;
	}

	public void blink(int color) {
		Drawable d = getDrawable(1);
		setDrawableByLayerId(0, d);
		setDrawableByLayerId(1, new ColorDrawable(color));
		startTransition(animationInterval);
		setDrawableByLayerId(0, getDrawable(1));
		setDrawableByLayerId(1, d);
		startTransition(animationInterval);
	}

}
